package com.zmj.proxy.jdk;

import java.lang.reflect.Proxy;

public class TestOrder {
    public static void main(String[] args) {

        OrderService os = new OrderServiceImpl();
        ServiceProxy sp = new ServiceProxy(os);

        //我们jdk给我们生成了一个代理对象;
        OrderService o = (OrderService) Proxy.newProxyInstance(os.getClass().getClassLoader(), os.getClass().getInterfaces(), sp);

        o.add(2);

        o.show();
    }
}
